<template>
  <div id="app2">
    <input type="text" v-model="msg1" />
    <button @click="add()">搜索</button>
  </div>
</template>

<script>
export default {
  name: "Search",

  data() {
    return {
      msg1: "",
    };
  },
  methods: {
    add() {
      console.log(this.msg1);
      this.$emit("getItem", this.msg1);
      this.msg1=""
    },
  },
};
</script>

<style lang="less" scoped>
</style>